package com.wngz.school.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.wngz.school.dto.ResponseResult;
import com.wngz.school.entity.Teacher;
import com.wngz.school.service.TeacherService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

@RestController
@RequestMapping("/teacher")
public class TeacherController {
    @Autowired
    private TeacherService teacherService;
    @GetMapping("/query/{pageNumber}/{pageSize}")
    public ResponseResult query(@PathVariable Integer pageNumber,
                                @PathVariable Integer pageSize,
                                @RequestParam Map<String, Object> params) {
        Page<Teacher> page = teacherService.query(pageNumber, pageSize, params);
        return ResponseResult.success(page);
    }

    @PostMapping("/remove")
    public ResponseResult remove(Integer id){
        teacherService.removeById(id);
        return ResponseResult.success();
    }


}
